#include <stdio.h>

class FloatStack{
 
    public:
	int N;
	float* data;
	int index;
	
	FloatStack(int n);

	bool push(float f){
		if(index==N)
			return false;
		data[index]=f;
		index++;
		return true;
	}
	
	float pop(){
		if(index==0)
			return data[0];
		index--;
		return data[index];
	}
};

FloatStack::FloatStack(int n) {
                this->index = 0;
		this->N = n;
		this->data=new float[this->N];
	}

int main (){
	
	FloatStack stack(5);
	stack.push(3.5);
	stack.push(6.0);
	stack.push(4.9);
	printf("%f\n",stack.pop());
	printf("%f\n",stack.pop());
	printf("%f\n",stack.pop());
	printf("%f\n",stack.pop());
	printf("%f\n",stack.pop());
	return 0;
}
